package com.dhwl.hsh.merchant.model.impl;

import com.dhwl.hsh.lib.api.ApiManager;
import com.dhwl.hsh.lib.bean.HttpResponse;
import com.dhwl.hsh.lib.bean.resp.MerchantResp;
import com.dhwl.hsh.lib.bean.resp.UserAuthResp;
import com.dhwl.hsh.lib.bean.resp.UserResponse;
import com.dhwl.hsh.merchant.model.IUserModel;

import rx.Observable;

/**
 * 简要描述
 *
 * @author Derek.Kidd
 * @version V1.0.0
 * @date 2016-04-13 15:42
 */
public class UserModel implements IUserModel {


    private UserModel() {
    }

    public static final UserModel instance = new UserModel();

    public static UserModel getInstance() {
        return instance;
    }

    @Override
    public Observable<HttpResponse<UserResponse>> login(String account, String pwd) {
        return ApiManager.getInstance().getUserApi().merchantLogin(account, pwd);
    }

    @Override
    public Observable<HttpResponse<MerchantResp>> getMerchant() {
        return ApiManager.getInstance().getUserApi().getMerchant();
    }

    @Override
    public Observable<HttpResponse<UserAuthResp>> getUserAuth() {
        return ApiManager.getInstance().getUserApi().getUserAuth();
    }


    @Override
    public Observable<HttpResponse<String>> fixPwd(String oldPwd,String newPwd) {
        return ApiManager.getInstance().getUserApi().fixPwd(oldPwd,newPwd);
    }
    @Override
    public Observable<HttpResponse<String>> resetPwd(String phone,String  newPwd ,String checkNum) {
        return ApiManager.getInstance().getUserApi().resetPwd(phone,newPwd,   checkNum);
    }

}
